package com.common.retrofit.bearusermethod;

import com.common.cons.Constans;
import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.service.BearUserService;
import com.common.utils.SortUtils;

import rx.Observable;
import rx.Subscriber;

public class BindPhoneAndLoginMethods extends BaseMethods {

    private static BindPhoneAndLoginMethods m_ins = null;

    public static BindPhoneAndLoginMethods getInstance() {
        if (m_ins == null) {
            synchronized (BindPhoneAndLoginMethods.class) {
                if (m_ins == null) {
                    m_ins = new BindPhoneAndLoginMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "api/User/";
    }

    private BearUserService initService() {
        return getRetrofit().create(BearUserService.class);
    }

    public void     bindMobile         (Subscriber<Object> subscriber , String uid , String hashid
            , String mobile
            , String checkcode
            , String invitation_code
    ) {
        String time  = System.currentTimeMillis()+"" ;
        Observable observable = initService().bindMobile(time,SortUtils.getMyHash("uid"+uid,
                "hashid"+hashid ,"time"+time
                ,"mobile"+mobile
                ,"checkcode"+checkcode
                ,"invitation_code"+invitation_code
        ),Constans.ANDROID_APP_ID,"3",uid,hashid,mobile,checkcode,invitation_code);
        toSubscribe(observable, subscriber);
    }
}
